Array.prototype.myFilter = function (f) {
    var newArray = []
    for (var i = 0; i < Array.length; i++) {
        if (f(this[i])) {
            newArray.push(this[i]);
        }
    }
    return newArray;
}

var a = [1, 2, 3, 4, 5, 6, 7];

var b = a.myFilter(e => e >= 4);

console.log(b);

